<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>帅哥美女走一走</title>
    <script src="../vue.js"></script>
</head>
<body>

    <!-- 点击按钮 改变3个li的顺序 在头上的就到末尾 -->
    <div id="app">
        <ul>
            <li v-for="item in arr">{{item}}</li>
        </ul>
        <button @click="fn">走一走</button>
    </div>

    <script>
        var app = new Vue({
            el: '#app',
            data:{
                arr : ['美女','帅哥', '程序员']
            },
            methods: {
                fn(){
                    // 1：
                    // var temp  = 0;
                    // var newArr = []
                    // temp = this.arr[2]
                    // newArr[2]= this.arr[0];
                    // newArr[0] = this.arr[1];
                    // newArr[1] = temp
                    // this.arr = newArr
                    
                    // 2：
                    this.arr.push(this.arr[0]),
                    // 头部的书局删除掉
                    this.arr.shift()
                }
            }

        })

    </script>
</body>
</html>